#include <iostream>
#include <cmath>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		int x,y;
		cin>>x>>y;
	    int k=sqrt((x-1)*(x-1)+(y-1)*(y-1));
	    if(k<6) cout<<"In"<<endl;
	    if(k==6) cout<<"On"<<endl;
	    if(k>6) cout<<"Out"<<endl;
	    
	}
	return 0;
}
